<%@page import="entities.Category"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.TreeMap"%>
<%@page import="helpers.UrlHelper"%>

<%
TreeMap check = (TreeMap) request.getAttribute("check");
String success = (String) request.getAttribute("success");
String form = (String) request.getAttribute("form");
Category category = (Category) request.getAttribute("category");
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/admin/layouts/header.jsp" />

<script type="text/javascript" src="/admin/js/category_form.js"></script>

		<div class="maincontent noright">
        	<div class="maincontentinner">
                <ul class="maintabmenu multipletabmenu">
                	<li><a href="/admin/category/list">Category Manager</a></li>
                	<li class="current"><a><%=form.equalsIgnoreCase("edit") ? "Update category" : "Add category" %></a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
					<jsp:include page="/admin/elements/message_box.jsp" />
                    <div class="contenttitle">
                    	<h2 class="form"><span>Information</span></h2>
                    </div><!--contenttitle-->
            
                    <form method="post" action="" class="stdform stdform2" id="edit_config_form">
                    	<p>
                        	<label>Id</label>
                            <span class="field">
                            	<%=category.getId() %>
                            	<input type="hidden" value="<%=category.getId() %>" name="id">
                            	<small>
                            		Small description of this field.
                            	</small>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Name</label>
                            <span class="field">
                            	<input type="text" class="smallinput" name="name" id="g_name" value="<%=category.getName() != null ? category.getName() : "" %>">
                            	<% if (check.get("name") != null) { %>
									<label for="g_name" generated="true" class="error"><%=check.get("name") %></label>
								<% } %>
                            </span>
                        </p>
                        <p>
                        	<label>Alias</label>
                            <span class="field">
                            	<input type="text" class="smallinput" name="alias" id="g_alias" value="<%=category.getAlias() != null ? category.getAlias() : "" %>" readonly="readonly">
                            	<% if (check.get("alias") != null) { %>
									<label for="g_alias" generated="true" class="error"><%=check.get("alias") %></label>
								<% } %>
                            </span>
                        </p>
                        <p class="stdformbutton">
                        	<button class="submit radius2">Submit</button>
                            <input type="reset" value="Reset" class="reset radius2">
                        </p>
                        
                    </form>
                    
                    <br clear="all">
                    
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp" />
            
        </div>

<jsp:include page="/admin/layouts/footer.jsp" />